<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8">
		<title>vue</title>
		<!--引入jquery-->
		<script src="http://code.jquery.com/jquery-latest.js"></script>
        <!-- 引入vue文件-->
		<script src="https://cdn.bootcss.com/vue/2.2.2/vue.min.js"></script>
		<!--引入bootstrap-->
		<script src="http://libs.baidu.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>
		<link href="http://libs.baidu.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet"/>
		
		<!--引入  axios-->
		<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
	</head>
	<body>
		<div id="vue">
			<ul v-for="(value,key) in user">
				<li>{{key}} : {{value}}</li>
			</ul>
			<br />
			<input type="button" @click="getData"  v-model="name"/>
		</div>
	</body>
	<script type="application/javascript">
		var vm=new Vue({
			el:'#vue',
			data:{
				name:'get',
				user:''
			},
			methods:{
				getData:function(){
					//发送请求,response是一个对象,有status,data等属性
					axios.get('data.json').then(function(response){
						alert(response.data.name);//houzheng
						vm.user=response.data;
					}).catch(function(error){
						alert("1111");
					});
				}
			},
			created:function(){
					//发送请求,response是一个对象,有status,data等属性
					axios.get('data1.json').then(function(response){
						alert(response.data.name);//houzheng
						vm.user=response.data;
					}).catch(function(error){
						alert("1111");
					});
			}
		});
	</script>
</html>
